package com.zy.ioc.pro5_ioc_import;

import com.zy.ioc.pro5_ioc_import.other.WaterMelon;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @program: mavenTest153
 * @description: 导入选择器一次性按条件导入多个类
 * @author: zy
 * @create: 2025-07-13 08:46
 */
public class FruitImportSelector implements ImportSelector {
    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        //可以根据条件来选择将哪此类路径下的jar中导入哪些类
        //用于spring boot自动导入类的功能: 读取一个jar包下的META-INF/spring.factories文件, 并根据文件中的配置来导入类
        return new String[]{ "com.zy.pro5_ioc_import.other.Grape", WaterMelon.class.getName()   };
    }
}
